<?php 
/*
Chương trình: "Quản lý Hóa Đơn và in hóa đơn Trường Thành"
Tác giả: "Lê Phương"
Phiên bản: "1.0"
Tệp tin: "switch.inc.php"
*/
$i1=$i*50-49; 	//951
$i2=$i*50;		//1000
$j1=($i+1)*50-49;
$j=$i+1;
$j2=($i+1)*50;		//1000
switch (strlen($i1)){
	case 1:
		$sotruoc1='000000'.$i1;
		$sosau1='00000'.$i2;
		break;
	case 2:
		$sotruoc1='00000'.$i1;
		$sosau1='0000'.$i2;
		break;
	case 3:
		$sotruoc1='0000'.$i1;
		if($i2==1000)
		{
			$sosau1='000'.$i2;
		}
		else
		{
			$sosau1='0000'.$i2;
		}
		break; 
	case 4:
		$sotruoc1='000'.$i1;
		if($i2==10000)
		{
			$sosau1='00'.$i2;
		}
		else
		{
			$sosau1='000'.$i2;
		}
		break; 
	case 5:
		$sotruoc1='00'.$i1;
		if($i2==100000)
		{
			$sosau1='0'.$i2;
		}
		else
		{
			$sosau1='00'.$i2;
		}
		break; 
	case 6:
		$sotruoc1='0'.$i1;
		if($i2==1000000)
		{
			$sosau1=''.$i2;
		}
		else
		{
			$sosau1='0'.$i2;
		}
		break; 
	case 7:
		$sotruoc1=''.$i1;
		$sosau1=''.$i2;
		break;
}
switch (strlen($j1)){
	case 1:
		$sotruoc2='000000'.$j1;
		$sosau2='00000'.$j2;
		break;
	case 2:
		$sotruoc2='00000'.$j1;
		$sosau2='0000'.$j2;
		break;
	case 3:
		$sotruoc2='0000'.$j1;
		if($j2==1000)
		{
			$sosau2='000'.$j2;
		}
		else
		{
			$sosau2='0000'.$j2;
		}
		break; 
	case 4:
		$sotruoc2='000'.$j1;
		if($j2==10000)
		{
			$sosau2='00'.$j2;
		}
		else
		{
			$sosau2='000'.$j2;
		}
		break; 
	case 5:
		$sotruoc2='00'.$j1;
		if($j2==100000)
		{
			$sosau2='0'.$j2;
		}
		else
		{
			$sosau2='00'.$j2;
		}
		break; 
	case 6:
		$sotruoc2='0'.$j1;
		if($j2==1000000)
		{
			$sosau2=''.$j2;
		}
		else
		{
			$sosau2='0'.$j2;
		}
		break; 
	case 7:
		$sotruoc2=''.$j1;
		$sosau2=''.$j2;
		break;
}
if($i<10){$i='0'.$i;}
if($j<10){$j='0'.$j;}
?>